package com.zz.entity;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {
	private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	private SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd");
	private SimpleDateFormat year = new SimpleDateFormat("yyyy");
	private SimpleDateFormat month = new SimpleDateFormat("MM");
	private SimpleDateFormat day = new SimpleDateFormat("dd");
	private SimpleDateFormat time = new SimpleDateFormat("HH:mm:ss");
	
	public String newDate() {
		return sdf.format(new Date());
	}
	public String getDateString(Date d) {
		return sdf.format(d);
	}
	public String getYear(Date d) {
		return year.format(d);
	}
	public String getMonth(Date d) {
		return month.format(d);
	}
	public String getDay(Date d) {
		return day.format(d);
	}
	public String getTime(Date d) {
		return time.format(d);
	}
	public String getNewDate() {
		return date.format(new Date());
	}
}
